package com.tinyengine.it.model.vo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.tinyengine.it.common.utils.JsonValidator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ApiEndpointVo {
    @Schema(name = "id", description = "主键id")
    private Integer id;
    private Integer appId;
    /**
     * 项目、服务信息ID
     */
    @NotNull(message = "目录ID不能为空")
    @Schema(description = "目录ID")
    private Integer directoryId;

    /**
     * 状态 ENUM(0-开发中, 1-已完成, 2-需修改, 3-已废弃)
     */
    @NotNull(message = "状态不能为空")
    @Schema(description = "0-开发中, 1-已完成, 2-需修改, 3-已废弃")
    private Integer status;

    /**
     * 描述
     */
    private String description;

    @NotNull(message = "名称不能为空")
    private String name;

    @NotNull(message = "code不能为空")
    private String code;

    /**
     * 头部
     */
    @JsonDeserialize(using = JsonValidator.class)
    @Schema(description = "头部 Json")
    private Map<String, Object> header;

    /**
     * 查询参数
     */
    @JsonDeserialize(using = JsonValidator.class)
    @Schema(description = "查询参数 Json")
    private Map<String, Object> queryParams;

    /**
     * 路径参数
     */
    @Schema(description = "路径参数 Json")
    private Map<String, Object> pathParams;

    /**
     * 请求体
     */
    @JsonDeserialize(using = JsonValidator.class)
    @Schema(description = "请求体 Json")
    private Map<String, Object> requestBody;

    /**
     * 方法（get、post）
     */
    @Schema(description = "方法（get、post）")
    @NotNull(message = "方法不能为空")
    private String method;

    /**
     * 接口请求路径
     */
    @NotNull(message = "接口请求路径不能为空")
    @Schema(description = "接口请求路径")
    private String pathReq;

    /**
     * 返回体
     */
    @JsonDeserialize(using = JsonValidator.class)
    @Schema(description = "返回体 Json")
    private Map<String, Object> responseBody;

}
